3.187 \(\int \tan (e+f x) (a+b \tan ^2(e+f x)) \, dx\)

Optimal. Leaf size=34 \[ \frac{b \tan ^2(e+f x)}{2 f}-\frac{(a-b) \log (\cos (e+f x))}{f} \]

[Out]

-(((a - b)*Log[Cos[e + f*x]])/f) + (b*Tan[e + f*x]^2)/(2*f)

________________________________________________________________________________________

Rubi [A]  time = 0.0221714, antiderivative size = 34, normalized size of antiderivative = 1., number of steps used = 2, number of rules used = 2, integrand size = 19, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.105, Rules used = {3631, 3475} \[ \frac{b \tan ^2(e+f x)}{2 f}-\frac{(a-b) \log (\cos (e+f x))}{f} \]

Antiderivative was successfully verified.

[In]

Int[Tan[e + f*x]*(a + b*Tan[e + f*x]^2),x]

[Out]

-(((a - b)*Log[Cos[e + f*x]])/f) + (b*Tan[e + f*x]^2)/(2*f)

Rule 3631

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (C_.)*tan[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp
[(C*(a + b*Tan[e + f*x])^(m + 1))/(b*f*(m + 1)), x] + Dist[A - C, Int[(a + b*Tan[e + f*x])^m, x], x] /; FreeQ[
{a, b, e, f, A, C, m}, x] && NeQ[A*b^2 + a^2*C, 0] &&  !LeQ[m, -1]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin{align*} \int \tan (e+f x) \left (a+b \tan ^2(e+f x)\right ) \, dx &=\frac{b \tan ^2(e+f x)}{2 f}+(a-b) \int \tan (e+f x) \, dx\\ &=-\frac{(a-b) \log (\cos (e+f x))}{f}+\frac{b \tan ^2(e+f x)}{2 f}\\ \end{align*}

Mathematica [A]  time = 0.0685205, size = 40, normalized size = 1.18 \[ \frac{b \left (\tan ^2(e+f x)+2 \log (\cos (e+f x))\right )}{2 f}-\frac{a \log (\cos (e+f x))}{f} \]

Antiderivative was successfully verified.

[In]

Integrate[Tan[e + f*x]*(a + b*Tan[e + f*x]^2),x]

[Out]

-((a*Log[Cos[e + f*x]])/f) + (b*(2*Log[Cos[e + f*x]] + Tan[e + f*x]^2))/(2*f)

________________________________________________________________________________________

Maple [A]  time = 0.002, size = 50, normalized size = 1.5 \begin{align*}{\frac{b \left ( \tan \left ( fx+e \right ) \right ) ^{2}}{2\,f}}+{\frac{\ln \left ( 1+ \left ( \tan \left ( fx+e \right ) \right ) ^{2} \right ) a}{2\,f}}-{\frac{\ln \left ( 1+ \left ( \tan \left ( fx+e \right ) \right ) ^{2} \right ) b}{2\,f}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(f*x+e)*(a+b*tan(f*x+e)^2),x)

[Out]

1/2*b*tan(f*x+e)^2/f+1/2/f*ln(1+tan(f*x+e)^2)*a-1/2/f*ln(1+tan(f*x+e)^2)*b

________________________________________________________________________________________

Maxima [A]  time = 1.18472, size = 50, normalized size = 1.47 \begin{align*} -\frac{{\left (a - b\right )} \log \left (\sin \left (f x + e\right )^{2} - 1\right ) + \frac{b}{\sin \left (f x + e\right )^{2} - 1}}{2 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(f*x+e)*(a+b*tan(f*x+e)^2),x, algorithm="maxima")

[Out]

-1/2*((a - b)*log(sin(f*x + e)^2 - 1) + b/(sin(f*x + e)^2 - 1))/f

________________________________________________________________________________________

Fricas [A]  time = 1.04847, size = 86, normalized size = 2.53 \begin{align*} \frac{b \tan \left (f x + e\right )^{2} -{\left (a - b\right )} \log \left (\frac{1}{\tan \left (f x + e\right )^{2} + 1}\right )}{2 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(f*x+e)*(a+b*tan(f*x+e)^2),x, algorithm="fricas")

[Out]

1/2*(b*tan(f*x + e)^2 - (a - b)*log(1/(tan(f*x + e)^2 + 1)))/f

________________________________________________________________________________________

Sympy [A]  time = 0.223503, size = 60, normalized size = 1.76 \begin{align*} \begin{cases} \frac{a \log{\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} - \frac{b \log{\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac{b \tan ^{2}{\left (e + f x \right )}}{2 f} & \text{for}\: f \neq 0 \\x \left (a + b \tan ^{2}{\left (e \right )}\right ) \tan{\left (e \right )} & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(f*x+e)*(a+b*tan(f*x+e)**2),x)

[Out]

Piecewise((a*log(tan(e + f*x)**2 + 1)/(2*f) - b*log(tan(e + f*x)**2 + 1)/(2*f) + b*tan(e + f*x)**2/(2*f), Ne(f
, 0)), (x*(a + b*tan(e)**2)*tan(e), True))

________________________________________________________________________________________

Giac [B]  time = 1.53251, size = 675, normalized size = 19.85 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(f*x+e)*(a+b*tan(f*x+e)^2),x, algorithm="giac")

[Out]

-1/2*(a*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2
*tan(f*x)*tan(e) + 1))*tan(f*x)^2*tan(e)^2 - b*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e)
 + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1))*tan(f*x)^2*tan(e)^2 - b*tan(f*x)^2*tan(e)^2 - 2*
a*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f
*x)*tan(e) + 1))*tan(f*x)*tan(e) + 2*b*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f
*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1))*tan(f*x)*tan(e) - b*tan(f*x)^2 - b*tan(e)^2 + a*log(4*(t
an(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e)
 + 1)) - b*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2
- 2*tan(f*x)*tan(e) + 1)) - b)/(f*tan(f*x)^2*tan(e)^2 - 2*f*tan(f*x)*tan(e) + f)